﻿using System;
using System.Data;
using System.Data.Common;

using Microsoft.Practices.EnterpriseLibrary.Data;

namespace Founder.PKURG.CRMCommon
{
    public class DbReaderUtility
    {
        public static string GetFieldValue(IDataReader reader, string colName)
        {
            if (reader[colName] == DBNull.Value)
            {
                return "";
            }
            else
            {
                return reader[colName].ToString();
            }
        }

        public static IDataReader ExecuteDataReader(Database db, DbCommand cmd)
        {
            return db.ExecuteReader(cmd);
        }
        public static DataSet ExcuteDataDaset(Database db, DbCommand cmd)
        {
            return db.ExecuteDataSet(cmd);
        }
        public static DataSet ExecuteDataSet(Database db, DbCommand cmd)
        {
            return db.ExecuteDataSet(cmd);

        }
        public static int ExecuteSQL(Database db, DbCommand cmd)
        {
            return db.ExecuteNonQuery(cmd);

        }
    }
}